package cn.itcast.bos.dao.base;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import cn.itcast.bos.domain.base.Standard;

public interface StandardRepository extends JpaRepository<Standard, Integer>{
	//方法一：
	public List<Standard> findByNameLike(String name);
	
	//方法二：nativeQuery = true,支持sql,為false支持jpql;
	@Query(value = "from Standard where name = ?",nativeQuery =false)
	public List<Standard> queryName(String name);
	
	//方法三：在实体类上使用@NamedQuerys({@NameQuery(name = "",query = ""   )})
	@Query
	public List<Standard> queryName2(String name);
	
	//修改：
	@Query(value = "update Standard set minLength = ?2 where id = ?1")
	@Modifying//修改和删除：
	public void updateQuery(Integer id,Integer minLength);
}
